package ipc;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;

import rddl.RDDL.DOMAIN;
import rddl.RDDL.INSTANCE;
import rddl.RDDL.NONFLUENTS;
import ipc.Relay;
import rddl.parser.parser;
import rddl.RDDL;

import java.util.Random;

class InstanceComparator implements Comparator<String>{

	final int SYSADMIN = 1;
	final int ELEVATOR = 2;
	final int TRAFFIC = 3;
	final int EVERYTHING_ELSE = 4;


	private RDDL rddlset;
	
	public InstanceComparator(RDDL rddlset){
		this.rddlset = rddlset;
	}
	
	private int assign(String o1){
		if( o1.contains("sysadmin") ) return SYSADMIN;
		else if( o1.contains("elevator") ) return ELEVATOR;
		else if (o1.contains("traffic") ) return TRAFFIC;
		else return EVERYTHING_ELSE;
	}

	public int compare(String o1, String o2) {

		int id1 = Integer.parseInt(o1.substring(o1.lastIndexOf('_')+1)); 
		int id2 = Integer.parseInt(o2.substring(o2.lastIndexOf('_')+1));
		if( id1 < id2 ) return -1;
		else if(id1==id2) return 0;
		else return 1;
		
	}
	
}


